package com.hopu.blb_erp.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hopu.blb_erp.entity.PageEntity;
import com.hopu.blb_erp.entity.TDrive;
import com.hopu.blb_erp.entity.TLogistics;
import com.hopu.blb_erp.mapper.LogsMapper;
import com.hopu.blb_erp.service.LogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogsServiceImpl extends ServiceImpl<LogsMapper, TLogistics> implements LogsService {
    @Autowired
    private LogsMapper logsMapper;

    @Override
    public List<TLogistics> findAllLogs() {
        return logsMapper.selectAllLogs();
    }

    @Override
    public PageEntity<TLogistics> findLogsPages(Integer current, Integer pageSize,String logisticsName) {
        // 查询角色总数
        Integer count = logsMapper.selectLogsCount(logisticsName);
        // 分页查询订单
        List<TLogistics> logistics = logsMapper.selectLogsPages((current-1) * pageSize, pageSize,logisticsName);
        // 包装到分页对象
        PageEntity<TLogistics> page = new PageEntity<>();
        page.setCount(count);
        page.setData(logistics);
        return page;
    }
}
